﻿#region "Copyright (C) Lenny Granovsky. 2005-2013"
//This program is free software distribute under the terms of the GNU General Public License as published by
//the Free Software Foundation. Please read AssemblyInfo.cs file for more information.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Web.Enhancements.Rest
{
    internal interface IParameterFormatter
    {
        void Initialize(System.Reflection.MethodInfo initializer);
        string FormatParameters(object[] parameters);
    }

    [Serializable()]
    internal abstract class ParameterFormatter : IParameterFormatter
    {
        protected System.Reflection.MethodInfo methodInfo { get; set; }

        protected ParameterFormatter()
        {
        }

        protected static IParameterFormatter CreateInstance(Type type, System.Reflection.MethodInfo initializer)
        {
            IParameterFormatter formatter = (IParameterFormatter)Activator.CreateInstance(type);
            formatter.Initialize(initializer);
            return formatter;
        }

        public abstract void Initialize(System.Reflection.MethodInfo initializer);

        public abstract string FormatParameters(object[] parameters);
    }
}
